var ChatFileMsg = (function(){
    
    var _fileMsgTmp = [
        '<div class="fileMsgWrapper" fileUrl="<%= o.fileUrl %>" seq="<%= o.seq %>">',
            '<div class="fileMsgIcon">',
                '<img class="fileMsgIconImg" src="<%= o.fileIcon %>"/>',
            '</div>',
            '<div class="fileMsgInfo">',
                '<h4 class="fileMsgName ellipsis" title="<%= o.fileName %>"><%= o.fileName %></h4>',
                '<span class="fileMsgSize">',
                    '<%= (o.fileSize || 0).toDiskSize("K", 2, true) %>',
                '</span>',
            '</div>',
        '</div>'
    ].join('');
    
    var _chatFileMsg = (function ChatFileMsg(){        
    }).extend(ChatMsg, 'ChatFileMsg');
    
    _chatFileMsg.prototype._init = function(){        
        var $fileMsg = $(tmpl(_fileMsgTmp, this.msg));
        
        this.$wrapper.find('.chatMsgItemContent').prepend($fileMsg);
        
        this.on('showProgressBar', function(){
            this.$sendProgressBar.progressBar({
                theme : 'fileMsgBar'
            });  
            this.progressBar = this.$sendProgressBar.data('progressBar');    
        });
                
        $fileMsg.on('click', function(){
            ujs.browser.file.downloadFromLink($(this).attr('fileUrl'));
        });    
    };
    
    return _chatFileMsg;
})();